<script setup lang="ts">
const AlipayLoginHandle = () => {
  const appId = '2021000148675589'
  const redirectUri = encodeURIComponent(`${import.meta.env.VITE_SERVE}/auth/Alipay`)
  const state = Math.random().toString(36).slice(2) // 防 CSRF
  const scope = 'auth_user' // 可选：auth_base | auth_user
  window.location.href =
      `https://openauth-sandbox.dl.alipaydev.com/oauth2/publicAppAuthorize.htm` +
      `?app_id=${appId}&scope=${scope}&redirect_uri=${redirectUri}&state=${state}`
}
</script>
<template>
  <slot :alipayLogin="AlipayLoginHandle"></slot>
</template>
<style scoped lang="scss"></style>
